package com.jiayan.model;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.Version;
import lombok.Data;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;

import java.io.Serializable;
import java.math.BigDecimal;
@Setter
@Getter
@Data
@ToString
public class EbProduct implements Serializable {

    @TableId
    private Integer epId;
    private String epName;
    private String epDescription;
    private BigDecimal epPrice;
    private Integer epStock;
    private Integer epcId;//商品的一级分类id
    private Integer epcChildId;//商品的二级分类的id
    private String epFileName;

    @TableField(exist = false)
    private int count;//表示购买数量

    @TableField(exist = false)
    private BigDecimal amount = new BigDecimal("0");//表示商品总价

//    @Version
//    private Integer version;//版本号

    @Override
    public int hashCode(){
        return 100;
    }

    @Override
    public boolean equals(Object obj){
        if(obj == null){
            return false;
        }
        if(obj == this){
            return true;
        }
        if(obj instanceof EbProduct){
            EbProduct ebProduct = (EbProduct) obj;
            if(this.epId.equals(ebProduct.getEpId())){
                return true;
            }else{
                return false;
            }
        }
        return false;
    }


}
